var config = require('./config.js')
var path = require('path')
var express = require('express')
var routes = require('./dist-routes')
var bodyParser = require('body-parser')
var color = require('colors')

var port = config.dist_port

var app = express()

app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: false }))
app.use('/', routes)
app.use(express.static('dist'))
var server = app.listen(port)
console.log('> Starting dist server...')
module.exports = {
  close: () => {
    server.close()
  }
}
